<?php
/**
 * 后台公共控制器
 * Created by PhpStorm.
 * User: yui
 * Date: 2017/4/16
 * Time: 21:41
 */

namespace common\controllers;


class BackendCommonCtrl extends CommonCtrl
{
    public $layout = 'main-home';

    public function init()
    {
        parent::init();
        if(!\Yii::$app->user->isGuest){
            $User = \Yii::$app->getUser();
            $userArr = iterator_to_array($User->identity);
            //设置token为常量
            define('TOKEN',$userArr['token']);
            define('USER',$userArr);
        }
    }
}